package org.qiandaosystem.qiandaosystemsource.dto;

import lombok.Data;
import org.qiandaosystem.qiandaosystemsource.entity.SignActivity;
import org.qiandaosystem.qiandaosystemsource.entity.Teacher;
import org.qiandaosystem.qiandaosystemsource.entity.User;

import java.time.LocalDateTime;

@Data
public class SignActivityDTO {
    private Integer id;
    private Integer teacherId;
    private String teacherName;    // 教师姓名
    private String teacherUsername; // 教师用户名
    private SignActivity.SignType type;
    private LocalDateTime startTime;
    private LocalDateTime endTime;

    public static SignActivityDTO fromEntity(SignActivity activity, Teacher teacher, User teacherUser) {
        SignActivityDTO dto = new SignActivityDTO();
        dto.setId(activity.getId());
        dto.setTeacherId(activity.getTeacherId());
        dto.setTeacherName(teacher.getRealName());
        dto.setTeacherUsername(teacherUser.getUsername());
        dto.setType(activity.getType());
        dto.setStartTime(activity.getStartTime());
        dto.setEndTime(activity.getEndTime());
        return dto;
    }
} 